<template>
  <div>
    <div class="box">
      <div class="box-1">
        <img src="../assets/个人中心/头像男 拷贝 4.png" alt="" />
        <p>{{ remark }}</p>
        <div class="box-2">
          <span class="box-3">姓名：{{ nickName }}</span
          ><span class="box-4">联系电话：{{ phone }}</span>
        </div>
      </div>
    </div>
    <ul class="app">
      <li @click="add">
        <img src="../assets/个人中心/Personal information.png" alt="" />
        <span>个人信息</span
        ><span class="app-1"><van-icon name="arrow" /></span>
      </li>
      <li>
        <img src="../assets/个人中心/形状 2.png" alt="" /> <span>支付中心</span
        ><span class="app-1"><van-icon name="arrow" /></span>
      </li>
      <li>
        <img src="../assets/个人中心/change Password.png" alt="" />
        <span>修改密码</span
        ><span class="app-1"><van-icon name="arrow" /></span>
      </li>
      <li @click="hangadd">
        <img src="../assets/个人中心/形状 2.png" alt="" />
        <span>版本信息</span>
        <span class="app-2">版本1.0<van-icon name="arrow" /></span>
      </li>
      <li>
        <img src="../assets/个人中心/组 16.png" alt="" /> <span>清除缓存</span
        ><span class="app-1"><van-icon name="arrow" /></span>
      </li>
    </ul>
    <van-button @click="appclick" class="btn" plain hairline type="primary"
      >退出按钮</van-button
    >
    <van-row>
      <van-col span="12" @click="$router.push('/home')">系统功能</van-col>
      <van-col span="12">个人中心</van-col>
    </van-row>
    <van-dialog v-model="show" title="退出登陆" @confirm='get' show-cancel-button show-confirm-button message-align="">
      确定退出登陆吗
    </van-dialog>
  </div>
</template>

<script>
import { userListData } from "../request/api";

export default {
  data() {
    return {
      nickName: "",
      phone: "",
      remark: "",
      show:false
    };
  },
  created() {
    userListData().then((res) => {
      console.log(res);
      let { nickName, phone, remark } = res.data;
      this.nickName = nickName;
      this.phone = phone;
      this.remark = remark;
    });
  },
  methods: {
    add() {
      console.log(1);
      this.$router.push("/myuser");
    },
    hangadd() {
      this.$router.push("/myuserversion");
      
    },
    appclick() {
      this.show=true
      
    },
    get(){
      setTimeout(()=>{
          this.$router.push("/login")
      },1000)
      
    }
  },
};
</script>
 
<style lang = "less" scoped>
.box {
  width: 100%;
  height: 200px;
  background-color: blue;
  position: relative;
  .box-1 {
    width: 80%;
    height: 180px;
    background-color: #ccc;
    position: absolute;
    left: 40px;
    bottom: -100px;
    text-align: center;
    img {
      width: 100px;
      height: 100px;
      position: absolute;
      top: -50px;
      left: 35%;
    }
    p {
      margin-top: 60px;
    }
    .box-2 {
      width: 100%;
      .box-3 {
        margin-right: 55px;
      }
      .box-4 {
        margin-left: 10px;
      }
    }
  }
}
.app {
  width: 80%;
  margin-top: 120px;
  background-color: #ccc;
  margin-left: 40px;
  li {
    padding: 10px;
    margin: 10px 0;
    border-bottom: 1px solid #fff;
    img {
      width: 20px;
      height: 20px;
    }
    .app-1[data-v-e0b47cf6] {
      margin-left: 200px;
    }
    .app-2 {
      margin-left: 145px;
    }
  }
}
.btn {
  width: 80%;
  color: red;
  background-color: #efefef;
  margin-left: 40px;
  margin-top: 15px;
}
.van-row {
  text-align: center;
  margin-top: 20px;
  padding: 20px;
  .van-col {
    border: 1px solid #000;
    line-height: 40px;
  }
}
</style>